/*************************************************************************
	> File Name: shdevmag.h
	> Author: yuarmy
	> Mail: yuarmy@126.com 
	> Created Time: Sun 03 Aug 2014 05:24:18 AM PDT
 ************************************************************************/

#ifndef SHDEV_SHDEVMAG_H_
#define SHDEV_SHDEVMAG_H_
#ifdef __cplusplus
extern "C" {
#endif
#define SH_MAX_PATH 1024

#include <sys/types.h>
#include <inttypes.h>
#include <termios.h>
typedef struct tagSHDevManage {
  int32_t server_sockfd; // damon server socket
  int32_t client_sockfd; // client socket which tranfer between webserver and device.
  int32_t test_sockfd;   // the test socket which is not used in work.
  int32_t uart_fd; // serial port file desc.
  fd_set readfds; // the select system call's parameter
  struct termios orig_term; // before serial port setting termios
  struct termios uart_term; // the config of serial port
  int32_t client_state;
  int32_t uart_state;
  int8_t  ipaddr[4]; // 
  int16_t port; // socket listen port
  int32_t backlog; // socket listen wait queue max num
  int32_t baud; // serial port
}SHDEVMANAGE_T;

int32_t InitSH(SHDEVMANAGE_T *shdev);
int32_t process(SHDEVMANAGE_T *shdev);
#ifdef __cplusplus
}
#endif
#endif //  SHDEV_SHDEVMAG_H_
